package com.zzyl.controller.manager.nursing;

import com.zzyl.base.PageBean;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.NursingLevelDto;
import com.zzyl.service.NursingLevelService;
import com.zzyl.vo.NursingLevelVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.Response;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "护理级别管理")
@RestController
@RequestMapping("/nursing/level")
@RequiredArgsConstructor
public class NursingLevelController {
    private final NursingLevelService nursingLevelService;

    @GetMapping("/listAll")
    @ApiOperation("查询所有护理等级")
    public ResponseResult listAll(){
        List<NursingLevelVo> list = nursingLevelService.listAll();
        return ResponseResult.success(list);
    }
    @PostMapping("/insert")
    @ApiOperation("查询所有护理等级")
    public ResponseResult InsertAll(@RequestBody NursingLevelDto nursingLevelDto){
        nursingLevelService.InsertAll(nursingLevelDto);
        return ResponseResult.success();
    }
   @GetMapping("/page")
   @ApiOperation("条件分页查询")
   public ResponseResult PageAll(Integer pageNum, Integer pageSize, String name, Integer status){
       PageBean<NursingLevelVo> list = nursingLevelService.PageAll(pageNum, pageSize, name, status);
       return ResponseResult.success(list);
   }

    @GetMapping("/{id}")
    @ApiOperation("根据id查询")
    public ResponseResult GetidAll(@PathVariable Integer id){
        NursingLevelVo nursingLevelVo=nursingLevelService.GetidAll(id);
        return ResponseResult.success(nursingLevelVo);
    }
    @PutMapping("/update")
    @ApiOperation("修改")
    public ResponseResult uqdateidAll(@RequestBody NursingLevelVo nursingLevelVo){
        nursingLevelService.uqdateidAll(nursingLevelVo);
        return ResponseResult.success();
    }
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除")
    public ResponseResult DeleteAll(@PathVariable Integer id){
        nursingLevelService.DeleteAll(id);
        return ResponseResult.success();
    }
    @PutMapping("/{id}/status/{status}")
    @ApiOperation("启用禁用")
    public ResponseResult BootdisableAll(@PathVariable Integer id,@PathVariable Integer status){
        nursingLevelService.BootdisableAll(id,status);
        return ResponseResult.success();
    }
}